#version 320 es
#ifdef GL_ES
	precision highp float;
#endif
out vec4 FragColor;

in vec2 position;

struct Circle {
	vec2 center;
	float radius;
};
uniform Circle circle;
uniform vec3 color;

void main() {
	float posZ = position.y;
	float centerZ = circle.center.y;
	float deltaX = abs(position.x - circle.center.x) / circle.radius;
	float deltaZ = abs(posZ - centerZ) / circle.radius;
	float fx = smoothstep(0.0, 1.0, deltaX);// args:(lower,higher,value)
	float fz = smoothstep(0.0, 1.0, deltaZ);
	float alpha = 1.0 - (1.0 - fx) * (1.0 - fz);
	alpha = pow(alpha, 3.0) - 0.1;
	FragColor = vec4(color, clamp(alpha, 0.0, 1.0));
}